﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Client
{
    public class Service
    {
        private static ShopServiceReference.AppServiceClient service;

        public static ShopServiceReference.AppServiceClient Instance
        {                      
            get
            {               
                if (service == null)
                {
                    service = new ShopServiceReference.AppServiceClient("WSHttpBinding_IAppService");
                }

                if (service.State == System.ServiceModel.CommunicationState.Faulted)
                {
                    service.Abort();
                    service = new ShopServiceReference.AppServiceClient("WSHttpBinding_IAppService");
                }

                return service;
            }
        }
    }//class
}
